﻿using System;
using System.Net;
using System.Web.Mvc; 
using Sharp.DataTransferObject.Workflow;
using Sharp.Infrastructure;
using Sharp.Infrastructure.WebApiClient; 
using Sharp.Portal.Mvc;
using Sharp.ServiceContracts; 
using Sharp.WebBooter.Areas.Workflow.Models;
 
namespace Sharp.WebBooter.Areas.Workflow.Controllers
{
    /// <summary>
    /// 流程定义控制器
    /// </summary>
    public class ProcessController : SharpController
    {
        [AutomaticTemplate]
        public ActionResult Index()
        {
            return View(new ProcessIndexModel());
        }
        /// <summary>
        ///     分页数据
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public ActionResult GetPaged(DataTableParameter parameters)
        {
            using (var proxy = new WebApiClientServiceProxy<IWorkflowService>())
            {
                var pageInfo = proxy.Channel.GetProcessPaged(parameters.ToPagingFeature());

                return this.Store(pageInfo);
            }
        }
     
        public ActionResult DesignUI(string processGuid)
        {
            using (var proxy = new WebApiClientServiceProxy<IWorkflowService>())
            {
                var dto = proxy.Channel.GetProcess(processGuid);

                return View("DesignUI", dto);
            }
        }
    }
}